{extends file="../acp.html"}

{block name="title"}{$head_title}{/block}
{block name="content"}
<script>
    function no_pic(obj) {
        obj.setAttribute("src", "/Public/Images/acp/nopicture.jpg");
    }
</script>

<div class="tablesWrap">
    <div class="tables-searchbox">
        <form method="post">
            <span class="tbs-txt">导师名称：</span>
            <input type="text" name="user_name" value="{$user_name}">

            <select name="is_recommend">
                <option value="-1" selected="">-是否推荐-</option>
                <option value="1" {if $is_recommend EQ 1}selected{/if}>是</option>
                <option value="0" {if $is_recommend EQ 0}selected{/if}>否</option>
            </select>

            <div class="mgt10">
                <span class="tbs-txt">添加时间：</span>
                <input type="text" autocomplete="off" class="Wdate" name="start_date" value="{$start_date|date_format:'%Y-%m-%d %H:%i'}"  onclick="WdatePicker({ dateFmt:'yyyy-MM-dd H:mm'})">
                <span class="tbs-txt">至</span>
                <input type="text" autocomplete="off" class="Wdate" name="end_date" value="{$end_date|date_format:'%Y-%m-%d %H:%i'}"  onclick="WdatePicker({ dateFmt:'yyyy-MM-dd H:mm'})">
                <button type="submit" class="btn"><i class="gicon-search"></i>搜索</button>
            </div>

        </form>
    </div>
    <!-- end tables-searchbox -->
    <table class="wxtables">
        <colgroup>
            <col width="5%">
            <col width="10%">
            <col width="15%">
            <col width="20%">
            <col width="10%">
            <col width="25%">
        </colgroup>
        <thead>
        <tr>
            <td>选择</td>
            <td>导师</td>
            <td>区域</td>
            <td>添加时间</td>
            <td>推荐</td>
            <td>操作</td>
        </tr>
        </thead>
        <tbody>
        {foreach from=$service_providers_list item=item name=list}
        <tr>
            <td><input type="checkbox" class="checkbox" value="{$item.item_id}" name="checkIds[]"></td>
            <td>{$item.user_name}</td>
            <td>{$item.area_string}</td>
            <td>{$item.addtime|date_format:"%Y-%m-%d %H:%M:%S"}</td>
            <td>{if $item.is_recommend == 1}是{else}否{/if}</td>
            <td>
                <a href="/AcpServiceApply/get_service_apply_list/service_providers_id/{$item.service_providers_id}" class="btn"  title="预约">查看预约</a>
                <a href="/AcpServiceProviders/edit_mentor/service_providers_id/{$item.service_providers_id}" class="btn" title="编辑">编辑</a>
                <a href="javascript:;" class="btn " onclick="set_status(4,{$item.service_providers_id})" title="删除">删除</a>
            </td>
        </tr>
        {foreachelse}
        <tr><td colspan="10">没有找到任何记录</td></tr>
        {/foreach}
        </tbody>
    </table>
    <!-- end wxtables -->
    <div class="tables-btmctrl clearfix">
        <div class="fl">
            <a href="javascript:selall()" class="btn btn-blue">全选</a>
            <a href="javascript:clearall()" class="btn btn-blue">取消</a>
            <a href="javascript:;" class="btn btn-blue ">删除</a>
        </div>
        <div class="fr">
            <div class="paginate">
                {$page->show()}
            </div>
            <!-- end paginate -->
        </div>
    </div>
    <!-- end tables-btmctrl -->
</div>
<!-- end tablesWrap -->
{/block}

{block name="js"}
<script src="/Public/Plugins/My97DatePicker/WdatePicker.js?version={$version}"></script>
<script src="__ACPJS__/acp_item.js?version={$version}"></script>
<script src="__ACPJS__/AcpItem/list_item.js?version={$version}"></script>
<script src="__JS__/front/jquery.showLoading.min.js?version={$version}"></script>
<script src="__JS__/clipboard.min.js"></script>
<link rel="stylesheet" href="__CSS__/front/showLoading.css?version={$version}">
<script>
    {literal}
    function set_status(status,service_providers_id) {
        var opt =''
        if(status == 1){
            opt ='通过审核/上架';
        }else if(status == 2){
            opt ='拒绝审核';
        }else if(status == 3){
            opt ='下架服务商';
        }else if(status == 4){
            opt ='删除服务商';
        }


        $.jPops.custom({
            title:opt,
            content:'确定'+opt+'吗?',
            okBtnTxt:"确定",
            cancelBtnTxt:"取消",
            callback:function(r)
            {
                if(r)
                {
                    $.post('/AcpServiceProviders/set_status',{'service_providers_id':service_providers_id,'service_providers_status':status},function(data) {
                        console.log(data)
                        if (data == 'success') {
                            alert('恭喜你, '+ opt +'成功');
                            location.reload();
                        } else {
                            alert('抱歉,'+ opt +'失败');
                        }
                    });
                }
                return true;
            }
        });

    }

    {/literal}

</script>
{/block}
